package GUI;

import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import javax.swing.JTextField;
import javax.swing.JLabel;
import javax.swing.JButton;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import ControlLayer.*;
import ModelLayer.Person;

public class SaleOrderPopUp {

	private JFrame frame;
	private JTextField customerText;
	private JTextField dateText;
	private JTextField statusText;
	private JTextField deliveryText;
	private JLabel lblInsertDeliveryStatus;
	private JLabel lblInsert;
	private Sale sale;
	private SalesOrderCtr salesOrderCtr;
	private JPanel panel;

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					SaleOrderPopUp window = new SaleOrderPopUp();
					window.frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}
	
	/**
	 * Create the application.
	 */
	public SaleOrderPopUp()
	{
		frame.setVisible(true);
		makeFrame();
		makePanel();
	}

	/**
	 * Initialize the contents of the frame.
	 */

	private void makeFrame()
	{
		frame = new JFrame();
		frame.setBounds(100, 100, 333, 343);
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
	}
	
	//Creates the buttons
	private void makeButtons()
	{
		JButton btnProceed = new JButton("Proceed");
		btnProceed.setBounds(218, 271, 89, 23);
		panel.add(btnProceed);
	}
	
	//Creates the textfields
	private void makeTextFields()
	{
		dateText = new JTextField();
		dateText.setBounds(155, 42, 86, 20);
		panel.add(dateText);
		dateText.setColumns(10);
		
		customerText = new JTextField();
		customerText.setBounds(155, 11, 86, 20);
		panel.add(customerText);
		customerText.setColumns(10);
		
		statusText = new JTextField();
		statusText.setBounds(155, 73, 86, 20);
		panel.add(statusText);
		statusText.setColumns(10);
		
		deliveryText = new JTextField();
		deliveryText.setBounds(155, 104, 86, 20);
		panel.add(deliveryText);
		deliveryText.setColumns(10);
	}
	
	//Creates the panel
	private void makePanel()
	{
		panel = new JPanel();
		frame.getContentPane().add(panel, BorderLayout.CENTER);
		panel.setLayout(null);
		
		makeButtons();
		makeLabels();
		makeTextFields();
	}
	
	//Creates the labels
	private void makeLabels()
	{
		lblInsertDeliveryStatus = new JLabel("Delivery status");
		lblInsertDeliveryStatus.setBounds(22, 76, 114, 14);
		panel.add(lblInsertDeliveryStatus);
		
		JLabel lblInsertDate = new JLabel("Insert Date");
		lblInsertDate.setBounds(22, 45, 74, 14);
		panel.add(lblInsertDate);
		
		lblInsert = new JLabel("Insert delivery date");
		lblInsert.setBounds(22, 107, 103, 14);
		panel.add(lblInsert);
		
		JLabel lblInsertCustomer = new JLabel("Insert Customer");
		lblInsertCustomer.setBounds(22, 14, 86, 14);
		panel.add(lblInsertCustomer);
	}
}
